﻿using AutoMapper;
using NetCore.Model.Enity;
using NetCore.Model.VeiwModels;

namespace NetCore.Common.AutoMapper
{
    public class CustomProfile : Profile
    {
        /// <summary>
        /// 配置构造函数，用来创建关系映射
        /// </summary>
        public CustomProfile()
        {
            CreateMap<SysUser, UserViewModel>()
                .ForMember(d => d.PassWord, o => o.MapFrom(s => s.UserPwd))//用于名称不一样进行映射
                .ForMember(s => s.RoleName, o => o.MapFrom(d => d.RoleName));//用于有子类的情况下
        }
    }
}